package controllers

import (
	"fmt"
	"github.com/astaxie/beego"
	//"gitee.com/yesy/mdzs.git/g"
	"gitee.com/yesy/mdzs.git/models/role"
)

type MainController struct {
	beego.Controller
}

func (c *MainController) Get() {

	username := "宁紫瑛"
	u := role.OneByIdInDB(username)
	
	if u == nil {
		fmt.Println("111111")
	}else{
		fmt.Println("RoleName:", u.RoleName)
	}
	
	c.Data["Website"] = "beego.me"
	c.Data["Email"] = "astaxie@gmail.com"
	c.Layout = "layout/admin.html"
	c.TplName = "index.tpl"
}

func (c *MainController) GetItem() {

	username := "宁紫瑛"
	u := role.OneByIdInDB(username)
	
	if u == nil {
		fmt.Println("111111")
	}else{
		fmt.Println("RoleName:", u.RoleName)
	}
	
	c.Data["Website"] = "beego.me"
	c.Data["Email"] = "astaxie@gmail.com"
	c.Layout = "layout/admin.html"
	c.TplName = "index.html"
}
